﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
/// <summary>
/// Summary description for BWTopProvinces
/// </summary>
namespace BCDataCenter.BOL
{
    public class BWTopProvinces
    {
        public BWTopProvinces()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public bool CheckExist(ref string error, string MonthYear)
        {
            return new DataAccessLayer.DAL().IsExistFromSQL("Tr_CheckAllSalesIndexYYYYWithMonth", CommandType.StoredProcedure, ref error, new SqlParameter("@MonthYear", MonthYear));
        }
        public bool InsertDanhHieu(ref string error, string UserName)
        {
            return new DataAccessLayer.DAL().MyExecuteNonQuery("Tr_TopRegionReportYearToDateDanhHieuInsert", CommandType.StoredProcedure, ref error, new SqlParameter("@UserName", UserName));
        }

        public bool RepairData(ref string error, string MonthYear, string UserName)
        {
            return new DataAccessLayer.DAL().MyExecuteNonQuery("Tr_TopRegionReportYearToDateRepairReport", CommandType.StoredProcedure, ref error,
                new SqlParameter("@MonthYear", MonthYear), new SqlParameter("@UserName", UserName));
        }

        public DataSet dsReport(ref string error, string MonthYear, string UserName, int Top)
        {
            return new DataAccessLayer.DAL().MyExecuteQuery(ref error, "Tr_TopRegionReportYearToDateViewReport", CommandType.StoredProcedure,
                new SqlParameter("@MonthYear", MonthYear),
                new SqlParameter("@UserName", UserName),
                new SqlParameter("@Top", Top));
        }

        public DataSet dsSumReport(ref string error, string MonthYear, string UserName)
        {
            return new DataAccessLayer.DAL().MyExecuteQuery(ref error, "Tr_TopRegionReportYearToDateViewReportGetSumYTD", CommandType.StoredProcedure,
                new SqlParameter("@MonthYear", MonthYear),
                new SqlParameter("@UserName", UserName));
        }
    }
}
